package com.mroapp.widget;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;
import com.mroapp.R;

public class LoadingDialog extends Dialog{
	private boolean isdispaly = false;
	private View.OnClickListener clickListener;
	private String content;

	protected LoadingDialog(Context context, boolean cancelable,OnCancelListener cancelListener) {
		super(context, cancelable, cancelListener);
	}

	public LoadingDialog(Context context, int theme) {
		super(context, theme);
	}
	public LoadingDialog(Context context, int theme,boolean isdispaly,String content) {
		super(context, theme);
		this.isdispaly = isdispaly;
		this.content = content;
	}

	public LoadingDialog(Context context) {
		super(context);
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		View view = LayoutInflater.from(getContext()).inflate(R.layout.dialog_layout, null);
		setContentView(view);
		ImageButton button = (ImageButton) view.findViewById(R.id.imageButton1);
		if (content != null) {
			TextView textView = (TextView) view.findViewById(R.id.textView);
			textView.setText(content);
		}
		if (isdispaly) {
			button.setVisibility(View.VISIBLE);
		}
		if (clickListener != null) {
			button.setOnClickListener(clickListener);
		}
	}
	public void cancel(View.OnClickListener clickListener){
		this.clickListener = clickListener;
	}

	@Override
	public void show() {
		try {
			super.show();
		} catch (Exception e) {
			// TODO: handle exception
		}
		
	}

	@Override
	public void dismiss() {
		super.dismiss();
	}

	public void setMsg(String txt) {

	}



}
